<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<c:choose>
	<c:when test="${deals != nul}">
		<p>All deals list</p>
		<table class="table table-hover">
			<thead>
				<tr>
					<th>Usługa</th>
					<th>Klient</th>
					<th>Pracownik</th>
					<th>Koszt</th>
					<th>Data</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach var="deal" items="${deals}">
					<tr>
						<td>
							<c:out value="${deal.service.serviceName}" />
						</td>
						<td>
							<c:out value="${deal.customer.firstName}"/> <c:out value="${deal.customer.lastName}"/>
						</td>
						<td>
							<c:out value="${deal.employee.firstName}"/> <c:out value="${deal.employee.lastName}"/>
						</td>
						<td>
							<c:out value="${deal.cost}" />
						</td>
						<td>
							${deal.dealDate.year}-${deal.dealDate.month}-${deal.dealDate.day} ${deal.dealDate.hour}:${deal.dealDate.minute}
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</c:when>
	<c:otherwise>
		<p>Sorry no data found ;(</p>
	</c:otherwise>
</c:choose>